package cn.ibizlab.odoo.core.odoo_fleet.service.impl;

import java.io.Serializable;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.HashMap;
import java.math.BigInteger;
import java.util.Collection;

import lombok.extern.slf4j.Slf4j;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cglib.beans.BeanCopier;
import org.springframework.stereotype.Service;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.Pageable;
import cn.ibizlab.odoo.core.client.model.Ifleet_vehicle;
import cn.ibizlab.odoo.core.odoo_fleet.domain.Fleet_vehicle;
import cn.ibizlab.odoo.core.odoo_fleet.filter.Fleet_vehicleSearchContext;
import cn.ibizlab.odoo.core.odoo_fleet.service.IFleet_vehicleService;
import cn.ibizlab.odoo.util.SearchResult;
import cn.ibizlab.odoo.util.log.IBIZLog;

/**
 * 实体[车辆] 服务对象接口实现
 */
@Slf4j
@IBIZLog
@Service
public class Fleet_vehicleServiceImpl implements IFleet_vehicleService {

    @Autowired
    private cn.ibizlab.odoo.core.client.service.Ifleet_vehicleClientService fleet_vehicleClientService;

    @Override
    public boolean remove(Integer id) {
        boolean bOk = false ;
        Ifleet_vehicle clientModel = fleet_vehicleClientService.createModel();
        clientModel.setId(id);
        fleet_vehicleClientService.remove(clientModel) ;
        bOk = true ;
        return bOk ;
    }

    @Override
    public void removeBatch(Collection<? extends Serializable> idList, int batchSize) {

        //fleet_vehicleClientService.removeBatch(fleet_vehicles) ;

    }

    @Override
    public boolean create(Fleet_vehicle fleet_vehicle) {
        boolean bOk = false ;
        Ifleet_vehicle clientModel = this.convert2Model(fleet_vehicle,null);
        fleet_vehicleClientService.create(clientModel) ;
        this.convert2Domain(clientModel,fleet_vehicle);
        bOk = true ;

        return bOk ;
    }

    @Override
    public void createBatch(List<Fleet_vehicle> fleet_vehicles, int batchSize) {

                        //fleet_vehicleClientService.createBatch(fleet_vehicles,batchSize) ;

    }

    @Override
    public boolean update(Fleet_vehicle fleet_vehicle) {
        boolean bOk = false ;
        Ifleet_vehicle clientModel = this.convert2Model(fleet_vehicle,null);
        fleet_vehicleClientService.update(clientModel) ;
        this.convert2Domain(clientModel,fleet_vehicle) ;
        bOk = true;
        return bOk ;
    }

    @Override
    public void updateBatch(List<Fleet_vehicle> fleet_vehicles, int batchSize) {

        //fleet_vehicleClientService.updateBatch(fleet_vehicles,batchSize) ;

    }

    @Override
    public Fleet_vehicle get(Integer id) {
        Ifleet_vehicle clientModel = fleet_vehicleClientService.createModel();
        clientModel.setId(id);
        fleet_vehicleClientService.get(clientModel) ;
        return this.convert2Domain(clientModel,null);
    }

    @Override
    public Fleet_vehicle get(Fleet_vehicle fleet_vehicle) {
        Fleet_vehicle retfleet_vehicle = this.get(fleet_vehicle.getId()) ;
    	BeanCopier copier=BeanCopier.create(retfleet_vehicle.getClass(), fleet_vehicle.getClass(), false);
        copier.copy(retfleet_vehicle, fleet_vehicle, null);
        return fleet_vehicle ;
    }

    /**
     * 查询集合 默认查询
     */
    @Override
    public Page<Fleet_vehicle> searchDefault(Fleet_vehicleSearchContext context) {
        List<Fleet_vehicle> list = new ArrayList<Fleet_vehicle>();
        Page<cn.ibizlab.odoo.core.client.model.Ifleet_vehicle> clientModelList = fleet_vehicleClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Ifleet_vehicle clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Fleet_vehicle>(list, context.getPageable(), clientModelList.getTotalElements());
    }


    /**
     * 根据车辆品牌查询
     */
    @Override
    public Page<Fleet_vehicle> selectByOdoo_brand(Integer id){
        Fleet_vehicleSearchContext context = new Fleet_vehicleSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Fleet_vehicle> list = new ArrayList<Fleet_vehicle>();
        Page<cn.ibizlab.odoo.core.client.model.Ifleet_vehicle> clientModelList = fleet_vehicleClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Ifleet_vehicle clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Fleet_vehicle>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据车辆型号查询
     */
    @Override
    public Page<Fleet_vehicle> selectByOdoo_model(Integer id){
        Fleet_vehicleSearchContext context = new Fleet_vehicleSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Fleet_vehicle> list = new ArrayList<Fleet_vehicle>();
        Page<cn.ibizlab.odoo.core.client.model.Ifleet_vehicle> clientModelList = fleet_vehicleClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Ifleet_vehicle clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Fleet_vehicle>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据车辆状态查询
     */
    @Override
    public Page<Fleet_vehicle> selectByOdoo_state(Integer id){
        Fleet_vehicleSearchContext context = new Fleet_vehicleSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Fleet_vehicle> list = new ArrayList<Fleet_vehicle>();
        Page<cn.ibizlab.odoo.core.client.model.Ifleet_vehicle> clientModelList = fleet_vehicleClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Ifleet_vehicle clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Fleet_vehicle>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据公司查询
     */
    @Override
    public Page<Fleet_vehicle> selectByOdoo_company(Integer id){
        Fleet_vehicleSearchContext context = new Fleet_vehicleSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Fleet_vehicle> list = new ArrayList<Fleet_vehicle>();
        Page<cn.ibizlab.odoo.core.client.model.Ifleet_vehicle> clientModelList = fleet_vehicleClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Ifleet_vehicle clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Fleet_vehicle>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据联系人查询
     */
    @Override
    public Page<Fleet_vehicle> selectByOdoo_driver(Integer id){
        Fleet_vehicleSearchContext context = new Fleet_vehicleSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Fleet_vehicle> list = new ArrayList<Fleet_vehicle>();
        Page<cn.ibizlab.odoo.core.client.model.Ifleet_vehicle> clientModelList = fleet_vehicleClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Ifleet_vehicle clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Fleet_vehicle>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据用户查询
     */
    @Override
    public Page<Fleet_vehicle> selectByOdoo_create(Integer id){
        Fleet_vehicleSearchContext context = new Fleet_vehicleSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Fleet_vehicle> list = new ArrayList<Fleet_vehicle>();
        Page<cn.ibizlab.odoo.core.client.model.Ifleet_vehicle> clientModelList = fleet_vehicleClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Ifleet_vehicle clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Fleet_vehicle>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据用户查询
     */
    @Override
    public Page<Fleet_vehicle> selectByOdoo_write(Integer id){
        Fleet_vehicleSearchContext context = new Fleet_vehicleSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Fleet_vehicle> list = new ArrayList<Fleet_vehicle>();
        Page<cn.ibizlab.odoo.core.client.model.Ifleet_vehicle> clientModelList = fleet_vehicleClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Ifleet_vehicle clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Fleet_vehicle>(list, context.getPageable(), clientModelList.getTotalElements());

    }



    public Ifleet_vehicle convert2Model(Fleet_vehicle domain , Ifleet_vehicle model) {
        if(domain == null)
            return model ;
        if(model==null){
            model = fleet_vehicleClientService.createModel() ;
        }

         if(domain.getFuel_typeDirtyFlag())
            model.setFuel_type(domain.getFuel_type());
         if(domain.getTag_idsDirtyFlag())
            model.setTag_ids(domain.getTag_ids());
         if(domain.getActivity_idsDirtyFlag())
            model.setActivity_ids(domain.getActivity_ids());
         if(domain.getMessage_unreadDirtyFlag())
            model.setMessage_unread(domain.getMessage_unread());
         if(domain.getWebsite_message_idsDirtyFlag())
            model.setWebsite_message_ids(domain.getWebsite_message_ids());
         if(domain.getPowerDirtyFlag())
            model.setPower(domain.getPower());
         if(domain.getMessage_needactionDirtyFlag())
            model.setMessage_needaction(domain.getMessage_needaction());
         if(domain.getResidual_valueDirtyFlag())
            model.setResidual_value(domain.getResidual_value());
         if(domain.getOdometerDirtyFlag())
            model.setOdometer(domain.getOdometer());
         if(domain.getMessage_channel_idsDirtyFlag())
            model.setMessage_channel_ids(domain.getMessage_channel_ids());
         if(domain.getFuel_logs_countDirtyFlag())
            model.setFuel_logs_count(domain.getFuel_logs_count());
         if(domain.getMessage_follower_idsDirtyFlag())
            model.setMessage_follower_ids(domain.getMessage_follower_ids());
         if(domain.getModel_yearDirtyFlag())
            model.setModel_year(domain.getModel_year());
         if(domain.getCar_valueDirtyFlag())
            model.setCar_value(domain.getCar_value());
         if(domain.getLicense_plateDirtyFlag())
            model.setLicense_plate(domain.getLicense_plate());
         if(domain.getContract_renewal_overdueDirtyFlag())
            model.setContract_renewal_overdue(domain.getContract_renewal_overdue());
         if(domain.getMessage_unread_counterDirtyFlag())
            model.setMessage_unread_counter(domain.getMessage_unread_counter());
         if(domain.getAcquisition_dateDirtyFlag())
            model.setAcquisition_date(domain.getAcquisition_date());
         if(domain.getActivity_date_deadlineDirtyFlag())
            model.setActivity_date_deadline(domain.getActivity_date_deadline());
         if(domain.getWrite_dateDirtyFlag())
            model.setWrite_date(domain.getWrite_date());
         if(domain.getActivity_user_idDirtyFlag())
            model.setActivity_user_id(domain.getActivity_user_id());
         if(domain.getActivity_type_idDirtyFlag())
            model.setActivity_type_id(domain.getActivity_type_id());
         if(domain.getHorsepower_taxDirtyFlag())
            model.setHorsepower_tax(domain.getHorsepower_tax());
         if(domain.getLocationDirtyFlag())
            model.setLocation(domain.getLocation());
         if(domain.getMessage_has_error_counterDirtyFlag())
            model.setMessage_has_error_counter(domain.getMessage_has_error_counter());
         if(domain.getMessage_idsDirtyFlag())
            model.setMessage_ids(domain.getMessage_ids());
         if(domain.getMessage_is_followerDirtyFlag())
            model.setMessage_is_follower(domain.getMessage_is_follower());
         if(domain.getActiveDirtyFlag())
            model.setActive(domain.getActive());
         if(domain.getHorsepowerDirtyFlag())
            model.setHorsepower(domain.getHorsepower());
         if(domain.getVin_snDirtyFlag())
            model.setVin_sn(domain.getVin_sn());
         if(domain.getDisplay_nameDirtyFlag())
            model.setDisplay_name(domain.getDisplay_name());
         if(domain.getMessage_has_errorDirtyFlag())
            model.setMessage_has_error(domain.getMessage_has_error());
         if(domain.getOdometer_countDirtyFlag())
            model.setOdometer_count(domain.getOdometer_count());
         if(domain.getMessage_partner_idsDirtyFlag())
            model.setMessage_partner_ids(domain.getMessage_partner_ids());
         if(domain.getMessage_needaction_counterDirtyFlag())
            model.setMessage_needaction_counter(domain.getMessage_needaction_counter());
         if(domain.getContract_renewal_nameDirtyFlag())
            model.setContract_renewal_name(domain.getContract_renewal_name());
         if(domain.getCreate_dateDirtyFlag())
            model.setCreate_date(domain.getCreate_date());
         if(domain.getActivity_summaryDirtyFlag())
            model.setActivity_summary(domain.getActivity_summary());
         if(domain.getSeatsDirtyFlag())
            model.setSeats(domain.getSeats());
         if(domain.getLog_fuelDirtyFlag())
            model.setLog_fuel(domain.getLog_fuel());
         if(domain.getCost_countDirtyFlag())
            model.setCost_count(domain.getCost_count());
         if(domain.getLog_driversDirtyFlag())
            model.setLog_drivers(domain.getLog_drivers());
         if(domain.get__last_updateDirtyFlag())
            model.set__last_update(domain.get__last_update());
         if(domain.getContract_renewal_due_soonDirtyFlag())
            model.setContract_renewal_due_soon(domain.getContract_renewal_due_soon());
         if(domain.getOdometer_unitDirtyFlag())
            model.setOdometer_unit(domain.getOdometer_unit());
         if(domain.getCo2DirtyFlag())
            model.setCo2(domain.getCo2());
         if(domain.getMessage_main_attachment_idDirtyFlag())
            model.setMessage_main_attachment_id(domain.getMessage_main_attachment_id());
         if(domain.getLog_contractsDirtyFlag())
            model.setLog_contracts(domain.getLog_contracts());
         if(domain.getFirst_contract_dateDirtyFlag())
            model.setFirst_contract_date(domain.getFirst_contract_date());
         if(domain.getActivity_stateDirtyFlag())
            model.setActivity_state(domain.getActivity_state());
         if(domain.getColorDirtyFlag())
            model.setColor(domain.getColor());
         if(domain.getDoorsDirtyFlag())
            model.setDoors(domain.getDoors());
         if(domain.getIdDirtyFlag())
            model.setId(domain.getId());
         if(domain.getMessage_attachment_countDirtyFlag())
            model.setMessage_attachment_count(domain.getMessage_attachment_count());
         if(domain.getNameDirtyFlag())
            model.setName(domain.getName());
         if(domain.getLog_servicesDirtyFlag())
            model.setLog_services(domain.getLog_services());
         if(domain.getContract_countDirtyFlag())
            model.setContract_count(domain.getContract_count());
         if(domain.getTransmissionDirtyFlag())
            model.setTransmission(domain.getTransmission());
         if(domain.getService_countDirtyFlag())
            model.setService_count(domain.getService_count());
         if(domain.getContract_renewal_totalDirtyFlag())
            model.setContract_renewal_total(domain.getContract_renewal_total());
         if(domain.getCompany_id_textDirtyFlag())
            model.setCompany_id_text(domain.getCompany_id_text());
         if(domain.getWrite_uid_textDirtyFlag())
            model.setWrite_uid_text(domain.getWrite_uid_text());
         if(domain.getDriver_id_textDirtyFlag())
            model.setDriver_id_text(domain.getDriver_id_text());
         if(domain.getCreate_uid_textDirtyFlag())
            model.setCreate_uid_text(domain.getCreate_uid_text());
         if(domain.getImage_mediumDirtyFlag())
            model.setImage_medium(domain.getImage_medium());
         if(domain.getImageDirtyFlag())
            model.setImage(domain.getImage());
         if(domain.getModel_id_textDirtyFlag())
            model.setModel_id_text(domain.getModel_id_text());
         if(domain.getImage_smallDirtyFlag())
            model.setImage_small(domain.getImage_small());
         if(domain.getBrand_id_textDirtyFlag())
            model.setBrand_id_text(domain.getBrand_id_text());
         if(domain.getState_id_textDirtyFlag())
            model.setState_id_text(domain.getState_id_text());
         if(domain.getCreate_uidDirtyFlag())
            model.setCreate_uid(domain.getCreate_uid());
         if(domain.getModel_idDirtyFlag())
            model.setModel_id(domain.getModel_id());
         if(domain.getBrand_idDirtyFlag())
            model.setBrand_id(domain.getBrand_id());
         if(domain.getCompany_idDirtyFlag())
            model.setCompany_id(domain.getCompany_id());
         if(domain.getState_idDirtyFlag())
            model.setState_id(domain.getState_id());
         if(domain.getDriver_idDirtyFlag())
            model.setDriver_id(domain.getDriver_id());
         if(domain.getWrite_uidDirtyFlag())
            model.setWrite_uid(domain.getWrite_uid());
        return model ;
    }

    public Fleet_vehicle convert2Domain( Ifleet_vehicle model ,Fleet_vehicle domain) {
        if(model == null)
            return domain ;
        if(domain == null){
            domain = new Fleet_vehicle();
        }

        if(model.getFuel_typeDirtyFlag())
            domain.setFuel_type(model.getFuel_type());
        if(model.getTag_idsDirtyFlag())
            domain.setTag_ids(model.getTag_ids());
        if(model.getActivity_idsDirtyFlag())
            domain.setActivity_ids(model.getActivity_ids());
        if(model.getMessage_unreadDirtyFlag())
            domain.setMessage_unread(model.getMessage_unread());
        if(model.getWebsite_message_idsDirtyFlag())
            domain.setWebsite_message_ids(model.getWebsite_message_ids());
        if(model.getPowerDirtyFlag())
            domain.setPower(model.getPower());
        if(model.getMessage_needactionDirtyFlag())
            domain.setMessage_needaction(model.getMessage_needaction());
        if(model.getResidual_valueDirtyFlag())
            domain.setResidual_value(model.getResidual_value());
        if(model.getOdometerDirtyFlag())
            domain.setOdometer(model.getOdometer());
        if(model.getMessage_channel_idsDirtyFlag())
            domain.setMessage_channel_ids(model.getMessage_channel_ids());
        if(model.getFuel_logs_countDirtyFlag())
            domain.setFuel_logs_count(model.getFuel_logs_count());
        if(model.getMessage_follower_idsDirtyFlag())
            domain.setMessage_follower_ids(model.getMessage_follower_ids());
        if(model.getModel_yearDirtyFlag())
            domain.setModel_year(model.getModel_year());
        if(model.getCar_valueDirtyFlag())
            domain.setCar_value(model.getCar_value());
        if(model.getLicense_plateDirtyFlag())
            domain.setLicense_plate(model.getLicense_plate());
        if(model.getContract_renewal_overdueDirtyFlag())
            domain.setContract_renewal_overdue(model.getContract_renewal_overdue());
        if(model.getMessage_unread_counterDirtyFlag())
            domain.setMessage_unread_counter(model.getMessage_unread_counter());
        if(model.getAcquisition_dateDirtyFlag())
            domain.setAcquisition_date(model.getAcquisition_date());
        if(model.getActivity_date_deadlineDirtyFlag())
            domain.setActivity_date_deadline(model.getActivity_date_deadline());
        if(model.getWrite_dateDirtyFlag())
            domain.setWrite_date(model.getWrite_date());
        if(model.getActivity_user_idDirtyFlag())
            domain.setActivity_user_id(model.getActivity_user_id());
        if(model.getActivity_type_idDirtyFlag())
            domain.setActivity_type_id(model.getActivity_type_id());
        if(model.getHorsepower_taxDirtyFlag())
            domain.setHorsepower_tax(model.getHorsepower_tax());
        if(model.getLocationDirtyFlag())
            domain.setLocation(model.getLocation());
        if(model.getMessage_has_error_counterDirtyFlag())
            domain.setMessage_has_error_counter(model.getMessage_has_error_counter());
        if(model.getMessage_idsDirtyFlag())
            domain.setMessage_ids(model.getMessage_ids());
        if(model.getMessage_is_followerDirtyFlag())
            domain.setMessage_is_follower(model.getMessage_is_follower());
        if(model.getActiveDirtyFlag())
            domain.setActive(model.getActive());
        if(model.getHorsepowerDirtyFlag())
            domain.setHorsepower(model.getHorsepower());
        if(model.getVin_snDirtyFlag())
            domain.setVin_sn(model.getVin_sn());
        if(model.getDisplay_nameDirtyFlag())
            domain.setDisplay_name(model.getDisplay_name());
        if(model.getMessage_has_errorDirtyFlag())
            domain.setMessage_has_error(model.getMessage_has_error());
        if(model.getOdometer_countDirtyFlag())
            domain.setOdometer_count(model.getOdometer_count());
        if(model.getMessage_partner_idsDirtyFlag())
            domain.setMessage_partner_ids(model.getMessage_partner_ids());
        if(model.getMessage_needaction_counterDirtyFlag())
            domain.setMessage_needaction_counter(model.getMessage_needaction_counter());
        if(model.getContract_renewal_nameDirtyFlag())
            domain.setContract_renewal_name(model.getContract_renewal_name());
        if(model.getCreate_dateDirtyFlag())
            domain.setCreate_date(model.getCreate_date());
        if(model.getActivity_summaryDirtyFlag())
            domain.setActivity_summary(model.getActivity_summary());
        if(model.getSeatsDirtyFlag())
            domain.setSeats(model.getSeats());
        if(model.getLog_fuelDirtyFlag())
            domain.setLog_fuel(model.getLog_fuel());
        if(model.getCost_countDirtyFlag())
            domain.setCost_count(model.getCost_count());
        if(model.getLog_driversDirtyFlag())
            domain.setLog_drivers(model.getLog_drivers());
        if(model.get__last_updateDirtyFlag())
            domain.set__last_update(model.get__last_update());
        if(model.getContract_renewal_due_soonDirtyFlag())
            domain.setContract_renewal_due_soon(model.getContract_renewal_due_soon());
        if(model.getOdometer_unitDirtyFlag())
            domain.setOdometer_unit(model.getOdometer_unit());
        if(model.getCo2DirtyFlag())
            domain.setCo2(model.getCo2());
        if(model.getMessage_main_attachment_idDirtyFlag())
            domain.setMessage_main_attachment_id(model.getMessage_main_attachment_id());
        if(model.getLog_contractsDirtyFlag())
            domain.setLog_contracts(model.getLog_contracts());
        if(model.getFirst_contract_dateDirtyFlag())
            domain.setFirst_contract_date(model.getFirst_contract_date());
        if(model.getActivity_stateDirtyFlag())
            domain.setActivity_state(model.getActivity_state());
        if(model.getColorDirtyFlag())
            domain.setColor(model.getColor());
        if(model.getDoorsDirtyFlag())
            domain.setDoors(model.getDoors());
        if(model.getIdDirtyFlag())
            domain.setId(model.getId());
        if(model.getMessage_attachment_countDirtyFlag())
            domain.setMessage_attachment_count(model.getMessage_attachment_count());
        if(model.getNameDirtyFlag())
            domain.setName(model.getName());
        if(model.getLog_servicesDirtyFlag())
            domain.setLog_services(model.getLog_services());
        if(model.getContract_countDirtyFlag())
            domain.setContract_count(model.getContract_count());
        if(model.getTransmissionDirtyFlag())
            domain.setTransmission(model.getTransmission());
        if(model.getService_countDirtyFlag())
            domain.setService_count(model.getService_count());
        if(model.getContract_renewal_totalDirtyFlag())
            domain.setContract_renewal_total(model.getContract_renewal_total());
        if(model.getCompany_id_textDirtyFlag())
            domain.setCompany_id_text(model.getCompany_id_text());
        if(model.getWrite_uid_textDirtyFlag())
            domain.setWrite_uid_text(model.getWrite_uid_text());
        if(model.getDriver_id_textDirtyFlag())
            domain.setDriver_id_text(model.getDriver_id_text());
        if(model.getCreate_uid_textDirtyFlag())
            domain.setCreate_uid_text(model.getCreate_uid_text());
        if(model.getImage_mediumDirtyFlag())
            domain.setImage_medium(model.getImage_medium());
        if(model.getImageDirtyFlag())
            domain.setImage(model.getImage());
        if(model.getModel_id_textDirtyFlag())
            domain.setModel_id_text(model.getModel_id_text());
        if(model.getImage_smallDirtyFlag())
            domain.setImage_small(model.getImage_small());
        if(model.getBrand_id_textDirtyFlag())
            domain.setBrand_id_text(model.getBrand_id_text());
        if(model.getState_id_textDirtyFlag())
            domain.setState_id_text(model.getState_id_text());
        if(model.getCreate_uidDirtyFlag())
            domain.setCreate_uid(model.getCreate_uid());
        if(model.getModel_idDirtyFlag())
            domain.setModel_id(model.getModel_id());
        if(model.getBrand_idDirtyFlag())
            domain.setBrand_id(model.getBrand_id());
        if(model.getCompany_idDirtyFlag())
            domain.setCompany_id(model.getCompany_id());
        if(model.getState_idDirtyFlag())
            domain.setState_id(model.getState_id());
        if(model.getDriver_idDirtyFlag())
            domain.setDriver_id(model.getDriver_id());
        if(model.getWrite_uidDirtyFlag())
            domain.setWrite_uid(model.getWrite_uid());
        return domain ;
    }


}
